<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNewPrecutTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('new_precut', function (Blueprint $table) {
            $table->id();
            $table->string('precut_id')->comment('套件名称');
            $table->integer('user_id')->comment('分配用户ID，可以为空，表示未分配')->default(0);
            $table->integer('status')->comment('0待安装1已安装')->default(0);
            $table->integer('created_by');
            $table->timestamps();
            $table->softDeletes();
        });
        Schema::create('new_precut_assign', function (Blueprint $table) {
            $table->id();
            $table->string('precut_id')->comment('套件主键');
            $table->integer('sold_by_user_id')->comment('发起用户ID')->default(0);
            $table->integer('sold_to_user_id')->comment('接收用户ID')->default(0);
            $table->integer('type')->comment('1分配2退货')->default(1);
            $table->integer('created_by');
            $table->timestamps();
            $table->softDeletes();
        });

        Schema::create('new_precut_part', function (Blueprint $table) {
            $table->id();
            $table->string('english_value')->comment('英文');
            $table->string('traditional_chiness_value')->comment('繁体');
            $table->string('simplified_chiness_value')->comment('简体');
            $table->integer('product_type_id')->comment('产品类型')->default(0);
            $table->integer('order')->comment('排序，值越大越靠前')->default(0);
            $table->integer('min_length')->comment('最小长度')->default(0);
            $table->integer('created_by');
            $table->timestamps();
            $table->softDeletes();
        });

        Schema::create('new_precut_coverage', function (Blueprint $table) {
            $table->id();
            $table->integer('precut_id')->comment('套件主键');
            $table->integer('part_id')->comment('new安装部位ID')->default(0);
            $table->integer('precut_or_manual')->comment('裁切或手工')->default(1);
            $table->string('roll_number')->comment('卷号');
            $table->integer('film_type_id')->comment('卷类型，与roll_master一致')->default(0);
            $table->integer('width')->comment('卷宽度，与roll_master一致')->default(0);
            $table->integer('length')->comment('用料长度')->default(0);
            $table->integer('created_by');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        // Schema::dropIfExists('new_warranty');
    }
}
